# $Id: PKGBUILD 148661 2012-02-05 11:46:00Z ibiru $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=xbill
pkgver=2.1
pkgrel=8
pkgdesc="A game that tests your reflexes as you seek and destroy all forms of Bill"
arch=('i686' 'x86_64')
url="http://www.xbill.org/"
license=('GPL')
depends=('xaw3d>=1.6')
makedepends=('libxaw')
install=xbill.install
source=(http://www.xbill.org/download/${pkgname}-${pkgver}.tar.gz
        03_fix_ftbfs_binutils_gold.diff)
md5sums=('585e4866b15255a24203db9959407b2f'
         'e260a6cd4f9af003d249961cb60e2d01')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  # taken from Debian
  patch -Np1 -i ${srcdir}/03_fix_ftbfs_binutils_gold.diff
  autoconf -v -f
  ./configure --prefix=/usr --mandir=/usr/share/man --localstatedir=/var/games \
    --disable-motif  --enable-athena --disable-gtk
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install

# set appropriate permissions and destinations
  chown root:games "${pkgdir}/usr/bin/xbill"
  chmod 2755 "${pkgdir}/usr/bin/xbill"

  chown root:games "${pkgdir}/var/games"
  chmod 775 "${pkgdir}/var/games"
  chown root:games "${pkgdir}/var/games/xbill"
  chmod 775 "${pkgdir}/var/games/xbill"

# Handle the scores file creation in the install script
  rm "${pkgdir}/var/games/xbill/scores"
}
